/* Find all key in server pageable */
import {doPostRequest, paginationToBackend} from "./BaseRequest";

/* Fetch all roles */
export function fetchAllRole(pagination, filters) {
    const data = {};
    Object.assign(data,paginationToBackend(pagination),filters);
    console.log("Begin to fetch auditing with filter:"+JSON.stringify(filters))
    return doPostRequest("/role/manage/list/all", data)
}

/* Create a role */
export function createRole(data) {
    return doPostRequest("/role/manage/create", data)
}

/* Disable a role */
export function disableRole(roleName) {
    const data = {"roleName": roleName}
    return doPostRequest("/role/manage/disable", data)
}


/* update a key */
export function updateRole(data) {
    return doPostRequest("/role/manage/update", data)
}


/* list permissions */
export function listPermissions(data) {
    data["pageNo"] = 1;
    data["pageSize"] = 200;
    return doPostRequest("/role/manage/permissions", data)
}